<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>消息详情</title>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport"/>
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="black" name="apple-mobile-web-app-status-bar-style">
    <meta content="telephone=no" name="format-detection">

    <!--语音css-->
    <link rel="stylesheet" href="/res/pltf/live/css/main.9707.css?v=20180105.110503">
    <link rel="stylesheet" href="/res/words/weui.css">
    <link rel="stylesheet" href="/res/words/jquery-weui.css">
    <link rel="stylesheet" href="/res/words/style.css">
    <link rel="stylesheet" href="http://at.alicdn.com/t/font_729135_t2loq20h12.css">
    <link rel="stylesheet" href="/res/words/audio.css">

    <script src="/res/words/jquery.min.js"></script>
    <script src="/res/words/jquery-weui.min.js"></script>
    <script src="/res/words/vue.js"></script>
    <!--聊天气泡css与js-->
    <link href="/res/words/basicstyle.css" type="text/css" rel="stylesheet">
    <link href="/res/words/operating.css" type="text/css" rel="stylesheet">

    <style>
        /*.weui-input{width:;}*/
        .weui-btn{background:#53aff2}
        .weui-cells {
            margin-top:0px;
        }
        .weui-cell{
            padding: 6px 15px;
        }
        a:hover{color: #fff}
        .weui-btn:not(.weui-btn_disabled):active{background-color: #53aff2;}

        .record-controller-zooe{height: 13.5rem;}
        .record-controller-zooe .recording_click .recording-txttip, .record-controller-zooe .recording_longtap .recording-txttip{
            font-size:1.2rem;top: 1rem;
            line-height: 1.2rem;}
        .record-controller-zooe .recording_click .btn-dd{}
        .record-controller-zooe .recording_click .btn-dd > i{
            width: 5.4rem;
            height: 5.4rem;
            margin: -2.7rem 0 0 -2.7rem;}
        .record-controller-zooe .recording_click .btn-dd .start-rec{
            width: 5rem;
            height: 5rem;
            margin: -2.5rem 0 0 -2.5rem;
        }
        .record-controller-zooe .recording_click .btn-dd .send_rec{
            width: 5rem;
            height: 5rem;
            line-height: 5rem;
            margin: -2.5rem 0 0 -2.5rem;
        }
        .record-controller-zooe .recording_click .btn-dd .stop_rec{
            width: 2rem;
            height: 2rem;
            margin: -1rem 0 0 -1rem;
        }
        .record-controller-zooe .cancel-rec-btn > .cancel-btn{    padding: 0 1rem;line-height: 2rem;    border-radius: 10px;}
        .record-controller-zooe .recording_click .type-dd .text::before, .record-controller-zooe .recording_longtap .type-dd .text::before{top: -5px;}

        .siw-container.single-voice .siw-main-wrap {
            padding: 0;
            height: 42px;
            margin-right: 24px;
        }
        .siw-container .siw-main-wrap {
            position: relative;
            padding: 8px 12px 8px 10px;
            border-radius: 5px;
            background-color: #bfdef6;
            border: solid 1px #9ed0f4;
        }

        @-webkit-keyframes layui-scale {
            0% {
                opacity: .3;
                -webkit-transform: scale(.5)
            }

            100% {
                opacity: 1;
                -webkit-transform: scale(1)
            }
        }
        @keyframes layui-scale {
            0% {
                opacity: .3;
                -ms-transform: scale(.5);
                transform: scale(.5)
            }
            100% {
                opacity: 1;
                -ms-transform: scale(1);
                transform: scale(1)
            }
        }
        .layui-anim-scale {
            -webkit-animation-name: layui-scale;
            animation-name: layui-scale;
        }
        .layui-anim-loop {
            -webkit-animation-iteration-count: infinite;
            animation-iteration-count: infinite
        }
    </style>
</head>

<body class="back1" style="background:#f9f9f9;padding-top:10px;" ontouchstart="" class="weui-pull-to-refresh">
<!--下拉加载-->
<div class="weui-pull-to-refresh__layer" id="moreDiv">
    <div class='weui-pull-to-refresh__arrow'></div>
    <div class='weui-pull-to-refresh__preloader'></div>
    <div class="down">下拉加载</div>
    <div class="up">释放刷新</div>
    <div class="refresh">正在加载</div>
</div>

<!--<div style="margin: 0 auto;text-align: center">-->
<!--<img id="trigger" src="/res/words/down.png" style="width: 9%;padding-top: 20px">-->
<!--</div>-->

<div id="app">
    <!--<div class="index-top-fix">-->
    <!--<a href="{:url('index/words/list_words')}" class="iconfont icon-left- left"></a>-->
    <!--<p class="title">留言详情</p>-->
    <!--</div>-->
    <div class="weui-cells__title" id="Tolist" style="display: none;text-align: center" >暂无更多数据</div>
    <div class="replyparts" style="margin-top: -5px;" >
        <!--内容-->
        <div  v-for="(item,index) in items" :data_id="item.id">
            <div class="repls_licon" v-if="item.is_teacher==0">
                <h3 style="color:black">{{item.name}}<span style="margin-left: 15px">{{item.time}}</span></h3>
                <p v-if="item.type==1"><i class="congst"></i>{{item.content}}</p>
                <p v-if="item.type==2"><i class="congst"></i><img style="height: 100px" :src="item.content"></p>
                <div v-if="item.type==3 || item.type==4" class="siw-container single-voice" style="float:left;" onclick="player.play(this)" :type="item.type">
                    <div class="siw-main-wrap voice-main">
                        <i class="congst"></i>
                        <div class="si-content">
                            <div class="content-voice">
                                <audio preload="none" :src="item.audio" :ser-duration="item.audio_time"  class="voice-audio"></audio>
                                <!--进度条-->
                                <section class="voi-control progressBar" style="display: none;">
                                    <div class="bar-bg"></div>
                                    <div class="voi-control speed voice-speed" style="width: 0%;">
                                        <div class="voi-control drag voice-drag">
                                        </div>
                                    </div>
                                </section>

                                <!--总时长-->
                                <span class="time">{{item.audio_time}}″</span>

                                <!--未听-->
                                <span class="not-listened" style="display: block;right: -9px"></span>

                                <div class="voice-play-control">
                                    <!--开始-->
                                    <img src="/res/images/live-voice-start.png?v=20171209.193010" class="voice-icon voice-content-start" style="display: block">
                                    <!--暂停-->
                                    <img src="/res/images/live-voice-pause.png?v=20171209.193010"  class="voice-icon voice-content-pause" style="display: none;">
                                    <!--加载中-->
                                    <img src="/res/images/live-loading.gif?v=20171209.193011" class="voice-icon voice-content-loading" style="display: none;">
                                    <!--播放中-->
                                    <img src="/res/images/playing.png"  class="voice-icon voice-content-playing layui-anim layui-anim-scale layui-anim-loop" style="animation-duration: 1.3s;display: none;">
                                </div>
                            </div>

                        </div>

                    </div>
                </div>
            </div>
            <div class="repls_licon secend_repl" v-if="item.is_teacher==1">
                <h3 style="color:black;overflow: hidden;padding-bottom: 0px;"><span style="float: right;font-size: 1.6rem;font-weight: normal;line-height: 3rem;padding-bottom: 0.5rem;">{{item.name}}</span><span style="margin-right: 15px;float: right;">{{item.time}}</span></h3>
                <p v-if="item.type==1" style="float: right;"><i class="congst"></i>{{item.content}}</p>
                <p v-if="item.type==2" style="float: right;"><i class="congst"></i><img style="height: 100px" :src="item.content"></p>
                <div v-if="item.type==3 || item.type==4" class="siw-container single-voice"  onclick="player.play(this)" :type="item.type">
                    <div class="siw-main-wrap voice-main">
                        <i class="congst"></i>
                        <div class="si-content">
                            <div class="content-voice">
                                <audio preload="none" :src="item.audio" :ser-duration="item.audio_time"  class="voice-audio"></audio>
                                <!--进度条-->
                                <section class="voi-control progressBar" style="display: none;">
                                    <div class="bar-bg"></div>
                                    <div class="voi-control speed voice-speed" style="width: 0%;">
                                        <div class="voi-control drag voice-drag">
                                        </div>
                                    </div>
                                </section>

                                <!--总时长-->
                                <span class="time" style="right:auto;left:10px;">{{item.audio_time}}″</span>

                                <!--未听-->
                                <span class="not-listened" style="display: block;left: -9px"></span>

                                <div class="voice-play-control" style="left:auto;right:7px;">
                                    <!--开始-->
                                    <img src="/res/images/live-voice-start.png?v=20171209.193010" class="voice-icon voice-content-start" style="display: block;transform:rotate(180deg);">
                                    <!--暂停-->
                                    <img src="/res/images/live-voice-pause.png?v=20171209.193010"  class="voice-icon voice-content-pause" style="display: none;">
                                    <!--加载中-->
                                    <img src="/res/images/live-loading.gif?v=20171209.193011" class="voice-icon voice-content-loading" style="display: none;">
                                    <!--播放中-->
                                    <img src="/res/images/playing2.png"  onclick="player.stop(this)" class="voice-icon voice-content-playing layui-anim layui-anim-scale layui-anim-loop" style="display: none;animation-duration: 1.3s;">
                                </div>
                            </div>

                        </div>

                    </div>
                </div>
            </div>
        </div>

    </div>

    <div style="background:#fff;overflow: hidden;width:100%;position: fixed;bottom: 0px;left: 0;">
        <div style="height: 25px;margin-left: 5px;margin-top: 8px">
            <div style="float: left;width:12%;margin-left: 1px ">
                <img id="uploaderInput2" style="height: 25px; " src="/res/words/pic_light.png">
                <!--<input id="uploaderInput" name="pic_url2" class="weui-uploader__input" type="file" accept="image/*" multiple="" style="display: none">-->
            </div>
            <div style="float: left;width: 12%;padding-bottom: 1px"><img style="height: 25px " src="/res/words/voice_light.png" onclick="voice()"></div>
        </div>
        <div id="write" class="weui-cells" style="width: 78%;float: left;border-right: 1px solid #f4f4f4;border-left: 1px solid #f4f4f4;margin-left: 5px;
        bottom: 5px;margin-top: 10px">
            <div class="weui-cell">
                <div class="weui-cell__bd">
                    <input class="weui-input" id="ty" type="text" placeholder="请输入内容">
                </div>
            </div>
        </div>
        <div id="answer" class="button_sp_area" style="float: right;width: 20%;margin-top: 9px" onclick="replay(this)">
            <a href="javascript:;" class="weui-btn weui-btn_mini weui-btn_primary" style="float: right;">发送</a>
        </div>
        <div id="show" style="width: 100%;border: 0px solid red;height: 100px;display: none;clear: both;margin: 5px auto">
            <!--<img v-if="url==''" v-bind  :src="url" style="width: 100%;height:100px;display: none">-->
            <!--<img v-else v-bind :src="pictures.url" style="width: 100%;height:100px;">-->
            <div class="button_sp_area" style="float: left;margin-left: 8px;width: 20%;margin-top: 65px" onclick="cancel(this)">
                <a href="javascript:;" class="weui-btn weui-btn_mini weui-btn_primary" style="clear:both;">取消</a>
            </div>
            <div style="width: 35%;height: 100px;margin-left: 40px;float: left;border: 0px solid orangered;"><img v-if="url" :src="url" style="width: 100%;height:100px;"></div>
            <div  class="button_sp_area" style="float: right;margin-right:8px;width: 20%;margin-top: 65px" onclick="picture(this)">
                <a href="javascript:;" class="weui-btn weui-btn_mini weui-btn_primary" style="clear:both;">发送</a>
            </div>
        </div>
        <div id="record-controller-bar" class="record-controller-zooe clearfix changeType"
             style="display: none;clear: both">
            <dl class="recording_click">
                <dd class="recording-txttip">
                    点击语音按钮开始录音，再次点击结束录音
                </dd> <!---->
                <dd class="btn-dd">
                    <i class="recording-ani layui-an1"></i>

                    <i class="recording-ani layui-an2 layui-anim layui-anim-scale layui-anim-loop"
                       style="animation-duration: 1.3s;display: none">
                    </i>
                    <!--//开始录音-->
                    <div class="btn-recording start-rec click-record-begin" onclick="record.start();"
                         style="display: block"></div>

                    <!--结束录音-->
                    <div class="btn-recording stop_rec click-record-stop " onclick="record.stop();"
                         style="display: none;"></div>

                    <!--完成-->
                    <div id="send-click-btn" class="btn-recording send_rec click-record-send"
                         onclick="record.send_voice()"
                         style="display: none;">发送
                    </div>
                </dd>
                <dd class="type-dd">
                    <div class="types-wrap">
                        <!--<span class="text slide left">长按</span>-->
                        <span class="text on text-ing1">单击</span>
                        <span class="text on text-ing2" style="display: none">正在录音中</span>
                    </div>
                </dd>
                <!--<dd class="changetype-btn"></dd>-->
                <!--完成-->
                <dd class="cancel-rec-btn click-record-cancel" style="display: none;">
                    <a href="javascript:;" onclick="record.cancel()" class="cancel-btn">取消</a>
                </dd>
            </dl>
            <!--<div id="rec-tips-bar"></div>-->
        </div>
    </div>
</div>

</body>
<script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script>

    var id="{$id}";
    console.log(id);
    <!--下拉加载-->
    var app = new Vue({
        el: '#app',
        data: {
            //初始化
            items: [],
            cur_page: 1,
            limit: 3,
            url:''

        },
    });

    //下拉加载更多
    $(function () {
        //进入加载页面
        loadlist();
        console.log("666");
        $("#ty").focus(function () {
            $('#write').show();
            $('#answer').show();
            $("#show").hide();
            $("#record-controller-bar").hide();
        });

    });


    $(document.body).pullToRefresh({
        /* 当下拉刷新触发的时候执行的回调 */
        onRefresh: function () {
            setTimeout(function() {
                $(document.body).pullToRefreshDone();
                loadlist();
            }, 2000);
        },
        /* 下拉刷新的触发距离， 注意，如果你重新定义了这个值，那么你需要重载一部分CSS才可以，请参考下面的自定义样式部分 */
        distance: 30
    });
    // 触发下拉加载事件
    // $(document.body).pullToRefresh(function() {
    //     setTimeout(function() {
    //         $(document.body).pullToRefreshDone();
    //
    //         loadlist();
    //     }, 2000);
    // });
    // $("#trigger").click(function () {
    //     $(document.body).pullToRefresh('triggerPullToRefresh')
    //     loadlist();
    // })

    //语音
    function voice() {
        $('#record-controller-bar').toggle();
        $('#show').hide();
        $('#write').toggle();
        $('#answer').toggle();
        $('.click-record-cancel').hide();
        $('.text-ing2').hide();
        $('.layui-an2').hide();
        $('.click-record-stop').hide();
        $('.click-record-begin').show();
        $('.text-ing1').show();
        $('.click-record-send').hide();
    }
    function cancel_voice() {
        $('#record-controller-bar').hide();
        $('.recording-ani').hide();
        $('.layui-an1').show();

        $('.btn-recording').hide();
        $('.start-rec').show();

        $('.types-wrap').show();
        $('.text-ing1').show();
        $('.text-ing2').hide();

    }

    //发送图片
    wx.config({
        debug: false,
        appId: '{$jsconfig.appId}',
        timestamp: '{$jsconfig.timestamp}',
        nonceStr: '{$jsconfig.noncestr}',
        signature: '{$jsconfig.signature}',
        jsApiList: [
            'checkJsApi',
            'onMenuShareTimeline',
            'onMenuShareAppMessage',
            'onMenuShareQQ',
            'onMenuShareWeibo',
            'hideMenuItems',
            'showMenuItems',
            'hideAllNonBaseMenuItem',
            'showAllNonBaseMenuItem',
            'translateVoice',
            'startRecord',
            'stopRecord',
            'onRecordEnd',
            'playVoice',
            'pauseVoice',
            'stopVoice',
            'uploadVoice',
            'downloadVoice',
            'chooseImage',
            'previewImage',
            'uploadImage',
            'downloadImage',
            'getNetworkType',
            'openLocation',
            'getLocation',
            'hideOptionMenu',
            'showOptionMenu',
            'closeWindow',
            'scanQRCode',
            'chooseWXPay',
            'openProductSpecificView',
            'addCard',
            'chooseCard',
            'openCard'
        ]
    });
    wx.isInit = false;
    wx.ready(function () {
        wx.checkJsApi({
            jsApiList: [
                'getNetworkType',
                'previewImage'
            ],
            success: function (res) {
//                alert(JSON.stringify(res));
            }
        });

//
        // 5 图片接口
        // 5.1 拍照、本地选图
        var images = {
            localId: [],
            serverId: []
        };

        $('#chooseImage').click(function () {

            wx.chooseImage({
                success: function (res) {
                    images.localId = res.localIds;
                    alert('已选择 ' + res.localIds.length + ' 张图片');
                }
            });

        });
        $('#uploaderInput2').click(function () {
            wx.chooseImage({
                success: function (res) {
                    images.localId = res.localIds;
                    console.log('已选择 ' + res.localIds.length + ' 张图片');
                    var i = 0, length = images.localId.length;
                    images.serverId = [];
                    function upload() {
                        wx.uploadImage({
                            localId: images.localId[i],
                            success: function (res) {

                                i++;
                                console.log('已上传：' + i + '/' + length);
                                //单个上传完成时
//                                record.send_img(res.serverId);
                                console.log("微信");
                                $.get('/index/api/tempfile2', {mid: res.serverId}, function (res) {
                                    console.log(res);
                                    if(res.code==200){
                                        // app.pictures.src=res.data.src;
                                        app.url=res.img;
                                        console.log(app.url+'图片地址');
                                        $('#record-controller-bar').hide();
                                        $('#write').hide();
                                        $('#answer').hide();
                                        $('#show').show();
                                    }
                                });

                                images.serverId.push(res.serverId);
                                if (i < length) {
                                    upload();
                                } else {
                                    //全部上传完成时


                                }
                            },
                            fail: function (res) {
//                                alert(JSON.stringify(res));
                            }
                        });
                    }

                    upload();

                }
            });
        });


    });

    wx.error(function (res) {
//        alert(res.errMsg);
    });

    //发送语音
    wx.ready(function () {

        wx.isInit = true;
        // 3 智能接口
        var voice = {
            localId: 'http://alcdn.wekuo.com/live-sys/system_start.mp3',
            serverId: ''
        };

        // 4.4 监听录音自动停止
        wx.onVoiceRecordEnd({
            complete: function (res) {
                voice.localId = res.localId;
                alert('录音时间已超过一分钟');
            }
        });



        // 4.8 监听录音播放停止
        wx.onVoicePlayEnd({
            complete: function (res) {
                console.log('录音（' + res.localId + '）播放结束');
            }
        });


        // 禁用分享菜单
        wx.hideOptionMenu();


    });

    wx.error(function (res) {
        console.log(res.errMsg);
    });
    //语音
    var player = {
        that: '',
        play: function (that) {

            if (!wx.isInit) {
                alert('音箱师就位中...')
                return false;
            }

            player.stop();
            player.that = that;
            console.log(that);
            var type = $(that).attr('type');
            if (type == 4) {
                var audio = $(that).find('.voice-audio')[0];
                audio.play();
                player.speed2(that);

            } else if (type == 3) {

                var voice_id = $(that).find('.voice-audio').attr('src');


                wx.downloadVoice({
                    serverId: voice_id,
                    success: function (res) {
                        console.log('下载语音成功，localId 为' + res.localId);
//                                        voice.localId = res.localId;
                        wx.playVoice({
                            localId: res.localId
                        });
                        player.speed2(that);
                    }
                });


            }


        },
        pause: function () {

        },
        stop: function () {

            var that = player.that;
            var type = $(that).attr('type');

            if(type == 4){
                var audio = $(that).find('.voice-audio')[0];
                console.log(audio+'777');
                audio.pause();
                audio.currentTime = 0.0;
            }else if(type == 3){
                var localId = $(that).find('.voice-audio').attr('src');
                wx.stopVoice({
                    localId: localId
                });
            }

            $(that).find('.not-listened').hide();
            $(that).find('.voice-content-playing').hide();
            $(that).find('.voice-content-start').show();
            // $(that).find('.voice-icon').hide();
            // $(that).find('.voice-content-start').show();


        },
        speed: function (that) {

            $(that).find('.progressBar').show();

            $(that).find('.voice-icon').hide();
            $(that).find('.voice-content-pause').show();
            var audio = $(that).find('.voice-audio')[0];
            var duration = $(audio).attr('ser-duration');
            var widthRadio = 1;
            try {
                widthRadio = Math.min(audio.currentTime / duration, 1);
            } catch (err) {
                console.log('widthRadio, err:', err);
            }


            if (widthRadio != 0) {
                $(that).find('.voice-speed')[0].style.width = widthRadio * 100 + "%";
            }
            return widthRadio;

        },
        speed2: function (that) {

//                            $(that).find('.progressBar').show();
            $(that).find('.voice-icon').hide();
            $(that).find('.voice-content-playing').show();
            var audio = $(that).find('.voice-audio')[0];
            $(that).find('.not-listened').hide();
            var duration = $(audio).attr('ser-duration');
            console.log(duration * 1000);
            setTimeout(function () {
                $(that).find('.not-listened').hide();

                $(that).find('.voice-icon').hide();
                $(that).find('.voice-content-start').show();
            }, duration * 1000)
        },
    };
    var record = {

        start_time: 0,
        end_time: 0,

        start: function () {

            if (!wx.isInit) {
                alert('音箱师就位中...')
                return false;
            }

            player.stop();

            $('.recording-ani').hide();
            $('.layui-an2').show();

            $('.btn-recording').hide();
            $('.stop_rec').show();

            $('.text-ing1').hide();
            $('.text-ing2').show();

            wx.startRecord({
                cancel: function () {
                    alert('用户拒绝授权录音');
                }
            });
            record.start_time = new Date().getTime();

        },
        stop: function () {
            $('.btn-recording').hide();
            $('#send-click-btn').show();
            $('.send_rec').show();

            $('.types-wrap').hide();
            $('.click-record-cancel').show();

            wx.stopRecord({
                success: function (res) {
                    voice.localId = res.localId;
                },
                fail: function (res) {
                    console.log(JSON.stringify(res));
                }
            });
            record.end_time = new Date().getTime();

        },
        cancel: function () {
            wx.stopRecord({
                success: function (res) {
                    voice.localId = res.localId;
                },
                fail: function (res) {
                    console.log(JSON.stringify(res));
                }
            });
            cancel_voice();
        },
        send_voice: function () {

            var diff_time = (record.end_time - record.start_time) / 1000;
            diff_time = Math.round(diff_time);
            var awith = '40%';
            console.log(diff_time);
            if (diff_time < 10 && diff_time > 3) {
                awith = diff_time * 10 + '%';
            } else if (diff_time < 4) {
                awith = '40%';
            } else {
                awith = '100%';
            }
            wx.uploadVoice({
                localId: voice.localId,
                success: function (res) {
                    console.log(res.serverId);
//                                    alert('上传语音成功，serverId 为' + res.serverId);
                    voice.serverId = res.serverId;
                    console.log(voice.serverId+'语音');
                    $.get('/index/api/tempvoice2', {mid: res.serverId}, function (res) {
                        console.log(res+'语音');
                        if(res.code==200){
                            $.post('{:url("index/words/voice")}',{voice:res.url,id:id,audio_time:diff_time},function (res) {

                                if(res.code==1){
                                    $.toast(res.msg);
                                    var s="details/id/"+id;
                                    // location.href=s;
                                    location.replace(location.href);
                                }else{
                                    $.alert(res.msg,function () {
                                        return false;
                                    });
                                }

                            })
                        }
                    });

                    // socket_send({type: 'voice', content: li});

                }
            });
        },

    }



    //ajax加载数据
    function loadlist() {
        $.post('{:url("list_details")}', {page: app.cur_page, limit: app.limit,id:id}, function (res) {
            console.log(res);
            if (res.count > 0) {
                $('.replyparts').show();
                if(app.cur_page==1){
                    app.items=res.data;
                }else {
                    var arr=[];
                    for (var index in res.data) {
                        arr.push(res.data[index]);
                        // app.items.unshift(res.data[index]);
                    }
                    console.log(arr+'888');
                    app.items=arr.concat(app.items);
                    console.log(app.items+'999');
                }
                app.cur_page++;

            } else {
                $("#Tolist").show();
                $("#moreDiv").hide();
            }

        });



    }
    //取消图片发送
    function cancel(that) {
       $('#show').hide();
        $('#write').show();
        $('#answer').show();

    }
    //发送图片
    function picture(that) {
        var thumb=app.url;
        $.post('{:url("picture")}',{id:id,thumb:thumb},function(res){
            if(res.code==1){
                $.toast(res.msg);
                // 定时跳转
                setTimeout(function(){
                    // location.href="{:url('words/list_words')}";
                    var s="details/id/"+id;
                    // location.href=s;
                    location.replace(location.href);
                    console.log("success");
                },500);
            }else{
                $.alert(res.msg,function () {
                    return false;
                });
            }
        })
    }
    //回复文字
    function replay(that){
        var ty=$('#ty').val();
        console.log(id+'123456');
        console.log(ty);

        if(ty==''){
            $.alert("请输入回复内容");
            return false;
        }

        $.post('{:url("words_replay")}',{id:id,wordscont:ty},function(res){
            console.log('123');
            if(res.code==1){
                $.toast(res.msg);
                // 定时跳转
                setTimeout(function(){
                    // location.href="{:url('words/list_words')}";
                    var s="details/id/"+id;
                    // location.href=s;
                    location.replace(location.href);
                    console.log("success");
                },500);
            }else{
                $.alert(res.msg,function () {
                    return false;
                });
            }
        })
    }
</script>
</html>

